#include "version.h"

#include <stdio.h>

const uint8_t VERSION_MAJOR = 0;
const uint8_t VERSION_MINOR = 0;
const uint8_t VERSION_PATCH = 4;

uint64_t get_version_code()
{
    return (uint64_t)VERSION_MAJOR * 0x1000000000000 +
           (uint64_t)VERSION_MINOR * 0x10000000000 +
           (uint64_t)VERSION_PATCH * 0x100000000 +
           (uint64_t)VERSION_BUILD_NUMBER;
}

const char* get_version_string()
{
    static char buff[64] = { 0 };
    if (buff[0] == '\0')
    {
        snprintf(buff, sizeof(buff), "%d.%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, VERSION_BUILD_NUMBER);
    }
    return buff;
}

const char* get_version_info_text()
{
    static char buff[64] = { 0 };
    if (buff[0] == '\0')
    {
        snprintf(buff, sizeof(buff), "Version: %d.%d.%d, Build: %d", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, VERSION_BUILD_NUMBER);
    }
    return buff;
}

extern const char* const VERSION_MAGIC_STR;

const char* get_version_magic_string(void)
{
    return VERSION_MAGIC_STR;
}
